import java.util.Scanner;

public class homework35 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入图形边长：");//输入图形的边长是多少
        int n = sc.nextInt();
        System.out.println("请输入组成图形边的字符：");//数入组成图形边的数字或者字符
        String b = sc.next();
        String str = "*";
        for (int i = 0; i < n; i++) {
            for (int a = 0; a < n; a++) {
                if (i == 0) {
                    System.out.print(b);
                } else if (i == n - 1) {
                    System.out.print(b);
                } else if (a == 0 || a == n - 1) {
                    System.out.print(b);
                } else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }

}
 
